<html>
	<head>
		<title>dojox.embed.Flash Detection Test</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<style type="text/css">
			@import "../../../dojo/resources/dojo.css";
			@import "../../../dijit/tests/css/dijitTests.css";
		</style>
		<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
		<script type="text/javascript">
			dojo.require("dojox.embed.Flash");

			/*******************************************************************
				A note.

				You *can* dojo.require dojox.embed.Flash on the fly (i.e.
				after load), but if you do so, you *must* give Safari and IE
				a little bit of time before you can start using any of the 
				methods.  Quick tests showed that 200ms is more than enough,
				but you should test intervals at your discretion.
			********************************************************************/
			var testMovieUrl=dojo.moduleUrl("dojox", "embed/tests/resources/hfp.swf"), movie;
			var proxyMovieUrl=dojo.moduleUrl("dojox", "embed/tests/resources/TestFlash.swf"), proxy;

			function log(msg){
				dojo.byId("fakeconsole").innerHTML += "<div>"+msg+"</div>";
			}
			
			dojo.addOnLoad(function(){
				dojo.byId("results").innerHTML = dojo.toJson(dojox.embed.Flash.version);
				movie=new dojox.embed.Flash({ path: testMovieUrl }, "flashHolder");
				dojo.connect(movie, "onReady", function(mv){
					console.log("The test movie loaded.");
				});
				
				proxy = new dojox.embed.Flash({ path: proxyMovieUrl, width:4, height:4 }, "proxyHolder");
				dojo.connect(proxy, "onLoad", function(m){
					dojox.embed.Flash.proxy(proxy, [ "setMessage", "getMessage" ]);
					console.log("Setting the message on the proxy to 'we love dojox.embed!'");
					proxy.setMessage("we love dojox.embed");
					console.log("The message stored in the test movie is: '", proxy.getMessage(), "'");
				});
			});
		</script>
	</head>
	<body>
		<h1>Dojo.embed.Flash detection tests.</h1>
		<p>
			This page is testing the base Flash movie generator.
		</p>
		<div id="fakeconsole"></div>	
		<p>Installed Flash version: <span id="results"></span>.</p>
		<div id="flashHolder" style="border:1px solid black;">
			A movie will be inserted here on load.
		</div>
		<div id="proxyHolder" style="width:4px;height:4px;position:absolute;"></div>
	</body>
</html>
